/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../../../model/baseModel';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasInvOperPriceJust extends BasicModel<BasInvOperPriceJust> {
  djno?: string; // 调价单号
  ddate?: string; // 调价日期
  basInvOperPriceJustRdsList?: BasInvOperPriceJustRds[]; // 子表列表
}

export interface BasInvOperPriceJustRds extends BasicModel<BasInvOperPriceJustRds> {
  parentid?: BasInvOperPriceJust; // 调价单
  justType?: string; // 调价方式
  invCode?: string; // 存货编码
  operCode?: string; // 存货编码
  iprice?: string; // 计件单价
  enDate?: string; // 生效日期
  exDate?: string; // 失效日期
  priceId?: string; // 价格ID
}

export const basInvOperPriceJustList = (params?: BasInvOperPriceJust | any) =>
  defHttp.get<BasInvOperPriceJust>({
    url: adminPath + '/bas/mes/price/basInvOperPriceJust/list',
    params,
  });

export const basInvOperPriceJustListData = (params?: BasInvOperPriceJust | any) =>
  defHttp.post<Page<BasInvOperPriceJust>>({
    url: adminPath + '/bas/mes/price/basInvOperPriceJust/listData',
    params,
  });

export const basInvOperPriceJustForm = (params?: BasInvOperPriceJust | any) =>
  defHttp.get<BasInvOperPriceJust>({
    url: adminPath + '/bas/mes/price/basInvOperPriceJust/form',
    params,
  });

export const basInvOperPriceJustSave = (params?: any, data?: BasInvOperPriceJust | any) =>
  defHttp.postJson<BasInvOperPriceJust>({
    url: adminPath + '/bas/mes/price/basInvOperPriceJust/save',
    params,
    data,
  });

export const basInvOperPriceJustDelete = (params?: BasInvOperPriceJust | any) =>
  defHttp.get<BasInvOperPriceJust>({
    url: adminPath + '/bas/mes/price/basInvOperPriceJust/delete',
    params,
  });

  export const priceImportData = (
    params: BasInvOperPriceJust,
    onUploadProgress: (progressEvent: ProgressEvent) => void,
  ) =>
    defHttp.uploadFile<BasInvOperPriceJust>(
      {
        url: ctxPath + adminPath + '/bas/mes/price/basInvOperPriceJust/importData',
        onUploadProgress,
      },
      params,
    );